<template>
	<div class="view">
		<Table highlight-row border stripe :loading="data.loading" :columns="columns" :data="data.data">
		</Table>
	</div>
</template>

<script>
	import CHeadIcon from '@/components/CHeadIcon.vue';

	export default {
		props: ['data'],
		components: {
			CHeadIcon
		},
		data() {
			return {
				columns: [{
					type: 'index',
					width: 60,
					fixed: 'left',
					align: 'center'
				}, {
					title: '邀请人',
					key: 'userName',
					align: 'center',
					width: 100,
					fixed: 'left'
				}, {
					title: '作品',
					key: 'ueTag.worksName',
					align: 'center',
					width: 150,
					render: (h, params) => {
						if(params.row.ueTag.etType == 1)
							return params.row.ueTag.worksName;
						else {
							return '无';
						}
					}
				}, {
					title: '邀请标签',
					key: 'ueTag.etNames',
					width: 100,
					align: 'center',
					render: (h, params) => {
						return JSON.parse(params.row.ueTag.etNames).join(' ');
					}
				}, {
					title: '标签类型',
					key: 'ueTag.etType',
					width: 90,
					align: 'center',
					render: (h, params) => {
						return params.row.ueTag.etType == 1 ? '普通标签' : '二级用户';
					}
				}, {
					title: '手机号',
					key: 'phoneNum',
					width: 120,
					align: 'center',
					render: (h, params) => {
						var phoneNum = params.row.phoneNum;
						return phoneNum;
					}
				}, {
					title: '被邀请人',
					key: 'ueTag.name',
					align: 'center',
					width: 100,
					render: (h, params) => {
						return params.row.ueTag.name;
					}
				}, {
					title: '角色名',
					key: 'ueTag.roleName',
					width: 120,
					align: 'center',
					render: (h, params) => {
						return params.row.ueTag.roleName;
					}
				}, {
					title: '邀请时间',
					key: 'inviteTime',
					align: 'center',
					fixed: 'right',
					width: 160,
					render: (h, params) => {
						var time = params.row.inviteTime;
						return new Date(parseInt(time) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
					}
				}, {
					title: '是否注册',
					key: 'isReg',
					width: 85,
					align: 'center',
					fixed: 'right',
					render: (h, params) => {
						var isReg = params.row.ueTag.isReg;
						return isReg == 1 ? "注册" : "未注册";
					}
				}]
			}
		},
		methods: {}
	}
</script>

<style scoped="scoped">

</style>